<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            width: 100%;
            height: 100%;
            background-image: url(./bgc.jpg);
            background-repeat: no-repeat;
            background-size: 100%;
        }

        div {
            width: 300px;
            height: 400px;
            border: 1px solid rgb(2, 5, 16);
            margin: 150px auto;
            border-radius: 5px;
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            flex-direction: column;
            background-color: rgba(254, 253, 255, 0.5);
        }

        #phone {
            height: 30px;
            width: 200px;
            margin-top: 50px;
            background-color: transparent;
        }

        #password {
            height: 30px;
            width: 200px;
            background-color: transparent;
        }

        button {
            width: 100px;
            height: 30px;
        }

        h2 {
            margin-top: 30px;
        }

        a {
            margin-top: 50px;
        }
    </style>
</head>

<body>
    <div>
        <h2>登录</h2>
        <input type="text" name="" id="phone" placeholder="手机号"><br>
        <!-- 用户名：<input type="text" id="userid"> -->
        <input type="password" id="password" placeholder="密码"><br>
        <button id="dl">登录</button>
        <a href="./test829zc.html">注册</a>
        <a href="./updatePassage.html">忘记密码</a>
    </div>

    <script src="./jquery-1.8.3.min.js"></script>
    <script>
        $("#dl").click(function () {
            // var userid = document.querySelector("#userid").value
            // var userpassword = document.querySelector("#password").value
            $.ajax({
                url: "http://172.16.106.87:8080/login",
                type: "get",
                data: { phone: $("#phone").val(), password: $("#password").val() },
                success: function (data) {
                    console.log(data);
                    // alert(data)
                    // localStorage.setItem("userList", JSON.stringify(data))
                    if (data.code == 200) {
                        alert("登陆成功")
                        window.location.href = "./people.html"
                    }else{
                        alert(data.message)
                    }

                }

            })
        })

    </script>
</body>

</html>